#include <iostream>
#include <unistd.h>
#include "krpc/sync.h"
#include "krpc/localstream.h"
#include "krpc/tcp.h"

int main(int argc, char **argv)
{
	KRPC::LOCALSTREAM com("unix");
	//KRPC::TCP com("127.0.0.1", 9100);
	KRPC::SyncFunc<std::string(const std::string &)> func("echo", com, 500);
	const std::string content = "hello wrold";
	while (1) {
		auto op = func(content);
		if (op && (*op) == content)
			std::cout << "echo succ" << std::endl;
		else
			std::cout << "echo fail" << std::endl;
		sleep(3);
	}
	return 0;
}
